package git.soulbgm.upload.controller;

import git.soulbgm.upload.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author 贺瑞杰
 * @version V1.0
 * @date 2018-09-28 14:47
 * @description @FeignClient(name = "producer") 标明feign调用的微服务名称
 */
@RestController
public class UploadController {

    @Resource
    private UploadService uploadService;

    @RequestMapping(value = "/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @ResponseBody
    public String uploadFile(@RequestPart("file") MultipartFile file){
        return uploadService.uploadFile(file);
    }

}
